package work;

import tree.MinPriorityQueue;
import tree.PriorityQueue;

import java.util.ArrayList;
import java.util.HashMap;

public class PriorityQueueTest {
    public static void main(String[] args) {
        ArrayList<String> strings = new ArrayList<>();
        HashMap<String, Integer> map = new HashMap<>();
        strings.add("abcdefg");
        strings.add("helloworldjava");
        strings.add("helloworldspark");
        strings.forEach(x->{
            char[] chars = x.toCharArray();
            for (int i = 0; i < chars.length; i++) {
                if (map.get(String.valueOf(chars[i]))!=null){
                    map.put(String.valueOf(chars[i]),map.get(String.valueOf(chars[i]))+1);
                }else {
                    map.put(String.valueOf(chars[i]),1);
                }
            }
        });
        System.out.println(map);
//        MinPriorityQueue<String> priorityQueue = new MinPriorityQueue<>(10);
//        priorityQueue.insert("s");
//        priorityQueue.insert("a");
//        priorityQueue.insert("a");
//        priorityQueue.insert("a");
//        priorityQueue.insert("a");
//        priorityQueue.insert("r");
//        priorityQueue.insert("z");
//       while (priorityQueue.size()>0){
//            System.out.print(priorityQueue.delMin());
//        }

//       priorityQueue.insert("m");
//        System.out.println(priorityQueue.delMin());
//        System.out.println(priorityQueue.size());
    }
}
